import { singleton } from "tsyringe";
import { RobotAppPage } from "../../page";
import { $ } from "../../../utils";

@singleton()
export class FrameLayout extends RobotAppPage {
    title: string = `Frame`
    isRuning: boolean = false;
    dispose(): void {
        this.out()
    }
    is(packageName: string): boolean {
        return `com.smile.gifmaker` === packageName|| `com.kuaishou.nebula` === packageName;
    }
    accept(activityName: string): boolean {
        return `android.widget.FrameLayout` === activityName;
    }
    in(): boolean {
        if (this.isRuning) return false;
        this.isRuning = true;
        const btn = textMatches(/.*?(以后再说)/).findOne()
        if (btn) {
            $.clickButton(btn)
        }
        log(`FrameLayout in`)
        return true;
    }
    out(): boolean {
        if (!this.isRuning) return false;
        this.isRuning = false;
        log(`FrameLayout out`)
        return true;
    }
}
